package homework0302;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add(new Point(1,2));
        c.add(new Point(3,4));
        c.add(new Point(5,6));
        c.add(new Point(7,8));
        c.add(new Point(9,0));
        c.add(new Point(1,2));
        System.out.println(c);
        Point p=new Point(1,2);
        boolean contain=c.contains(p);
        System.out.println("是否包含"+contain);

        c.remove(p);
        System.out.println(c);//删除集合c与集合p第一个共有的值

        Collection c1=new ArrayList();
        Point p1=new Point(0,1);
        c1.add(p1);//将p1添加到集合c1中
        System.out.println(c1);
        p1.setX(10);
        System.out.println(c1);//10,1

        Collection c2=new ArrayList();
        c2.add("one");
        c2.add("two");
        c2.add("three");
        c2.add("four");
        c2.add("five");
        System.out.println(c2);
        System.out.println(c2.size());//size,集合的长度

        c2.clear();//清空集合
        System.out.println(c2);//[];
        System.out.println(c2.size());//0
        System.out.println(c2.isEmpty());//是否为空集






    }
}
